package entidades;

import java.io.Serializable;
import javax.persistence.*;


/**
 * The persistent class for the turma database table.
 * 
 */
@Entity
@Table(name="turma")
public class Turma implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="codTurma")
	private int codTurma;
	
	@ManyToOne
	@JoinColumn(name="professor_codProfessor")
	private Professor professor;
	
	public Turma() {
	}

	public int getCodTurma() {
		return codTurma;
	}

	public void setCodTurma(int codTurma) {
		this.codTurma = codTurma;
	}

	public Professor getProfessor() {
		return professor;
	}

	public void setProfessor(Professor professor) {
		this.professor = professor;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + codTurma;
		result = prime * result
				+ ((professor == null) ? 0 : professor.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Turma other = (Turma) obj;
		if (codTurma != other.codTurma)
			return false;
		if (professor == null) {
			if (other.professor != null)
				return false;
		} else if (!professor.equals(other.professor))
			return false;
		return true;
	}
}